let str = '',ss='';
let az = "abcdefghijklmnopqrstuvwxyz";
let AZ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
let num = "0123456789";
let sp = "!@#$%";
function getAllChar(){
    let all = document.getElementsByName('join');
    if(all[0].checked){
        for(let i = 0;i<26;++i){
            if(ss.indexOf(az[i])===-1) str+=az[i];
        }
    }
    if(all[1].checked){
        for(let i = 0;i<26;++i){
            if(ss.indexOf(AZ[i])===-1) str+=AZ[i];
        }
    }
    if(all[2].checked){
        for(let i = 0;i<10;++i){
            if(ss.indexOf(num[i])===-1) str+=num[i];
        }
    }
    if(all[3].checked){
        for(let i = 0;i<5;++i){
            if(ss.indexOf(sp[i])===-1) str+=sp[i];
        }
    }
}
function  deleteChar(){
    let del = document.getElementsByName('delete');
    if(del[0].checked){
        ss = document.getElementById('clear').value;
        // let len = ss.length;
        // for(let i = 0;i<len;++i){
        //     str.slice(str.indexOf(ss[i]),1);//js难以删除变量，考虑添加字符方式
        // }
    }
}
function create(){
    str = "";
    deleteChar();
    getAllChar();
    console.log(str);
    let len = str.length;//字符串长度
    let length =  parseInt(document.getElementById('length').value);//密码长度
    let number = parseInt(document.getElementById('number').value);
    let ans = "";
    for(let i = 0;i<number;++i){
        ans ="";
        for(let j = 1;j<=length;++j){
            let x = Math.floor(Math.random()*len);
            ans+=str[x];
        }
        document.getElementById('out').innerHTML+=ans+'\n';
    }
}